package org.aurora.framework.boot.data.common.dataobject;

import java.io.Serializable;
import java.util.Objects;

/**
 * name: BaseDO
 * <p>
 * desc: Base data object
 * <p>
 * create date: 2024-09-25 12:47:22
 *
 * @author cao.yong
 */
public interface BaseDO<ID extends Serializable> extends Serializable {

    /**
     * Set object primary identity
     *
     * @param id identity
     */
    void setId(ID id);

    /**
     * Get object primary identity
     * @return identity
     */
    ID getId();

    /**
     * Determine whether it is a new object
     * @return If it is a new object, return True; otherwise, return False
     */
    default boolean isNew() {
        return Objects.isNull(this.getId());
    }
}
